package com.jacky.controller;

import com.jacky.annotation.MyLog;
import com.jacky.annotation.OpenApi;
import com.jacky.entity.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloWorldController {

    @RequestMapping("/hello")
    @MyLog("hello MyLog")
    public String index() {
        return "Hello World";
    }


    @RequestMapping("/helloOpenApi")
    @OpenApi
    public User helloOpenApi(){
        User user = new User();
        user.setId(1);
        user.setName("dog");
        return user;
    }

    @RequestMapping("/helloReponseBody")
    @ResponseBody
    public User helloReponseBody(){
        User user = new User();
        user.setId(2);
        user.setName("cat");
        return user;
    }
}